package cn.zh.controller;

import cn.zh.entity.User;
import cn.zh.service.MqSendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class MqSendController {

    @Resource
    private MqSendService sendService;

    @PostMapping("direct-msg")
    public void sendDirectMsg(@RequestBody String msg){
        sendService.sendMsg(msg);
    }

    @PostMapping("direct-user")
    public void sendDirectUser(@RequestBody User user){
        sendService.sendDirectUser(user);
    }

    @PostMapping("repeat/direct-msg")
    public void sendRepeatDirectMsg(@RequestBody String msg){
        sendService.sendRepeatDirectMsg(msg);
    }

    @PostMapping("repeat/fanout-msg")
    public void sendFanoutMsg(@RequestBody String str){
        sendService.sendFanoutMsg(str);
    }

    @PostMapping("repeat/topic-msg")
    public void sendTopicMsg(@RequestBody String str){
        sendService.sendTopicMsg(str);
    }
}
